let students = [1,1,1,0,0,1], sandwiches = [1,0,0,0,1,1]
var countStudents = function(students, sandwiches) {
    let k=0
    while(sandwiches.length){
        if(students[0]==sandwiches[0]){
            students.shift()
            sandwiches.shift()
            k=0
        }else{
            students.push(students.shift())
            k++
            if(k==students.length){
                return k
            }
        }
    }
    return 0
};
console.log(countStudents(students,sandwiches));
